User-2035378889 posted
Hello Every One
I want to gent current user Company and save in all Table where is field name company
am using this
public ActionResult AddSupplier(SupplierModel model,UserAccountModel)
{
if (ModelState.IsValid)
{
var username = System.Web.HttpContext.Current.User.Identity.Name;
model.Company = username;
_supplierRepository.Insert(model);
return RedirectToAction("SupplierList");
}
return View(model);
}
var username = System.Web.HttpContext.Current.User.Identity.Name
above line return user Email
but I need user company
this is my user Account Model Class
using PharmaApp.Core.DataModel.Base;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace PharmaApp.Core.DataModel
{
[Table("UserAccount")]
public class UserAccountModel : BaseModel
{
[Required]
[StringLength(30)]
public string Name { get; set; }
[EmailAddress]
[Required]
public string Email { get; set; }
[Required]
public string Password { get; set; }
[Required]
public string Role { get; set; }
public new string Company { get; set; }
}
}
I need this
public new string Company { get; set; }
thanks To All