コード例 #1
0
ファイル: EmpOtherService.cs プロジェクト: KuldipBhuva/TDMS
        public int Update(EmpOtherItem model)
        {
            Mapper.CreateMap <EmpOtherItem, EmployeeOtherDetail>();
            EmployeeOtherDetail objOther = DbContext.EmployeeOtherDetails.SingleOrDefault(m => m.OtherId == model.OtherId);

            objOther = Mapper.Map(model, objOther);
            return(DbContext.SaveChanges());
        }
コード例 #2
0
ファイル: EmpOtherService.cs プロジェクト: KuldipBhuva/TDMS
        public EmpOtherItem GetById(int id)
        {
            Mapper.CreateMap <EmployeeOtherDetail, EmpOtherItem>();
            EmployeeOtherDetail objOther     = DbContext.EmployeeOtherDetails.SingleOrDefault(m => m.OtherId == id);
            EmpOtherItem        objOtherItem = Mapper.Map <EmpOtherItem>(objOther);

            return(objOtherItem);
        }
コード例 #3
0
        public ActionResult Edit(int id, int OtId)
        {
            EmpOtherService objOtherService = new EmpOtherService();
            EmpOtherItem    objOtherItem    = new EmpOtherItem();

            objOtherItem = objOtherService.GetById(OtId);
            //Session["Empid"] = objOtherItem.EmpId;
            List <EmpOtherItem> lstOther = new List <EmpOtherItem>();

            objOtherItem.ListOther = new List <EmpOtherItem>();
            objOtherItem.ListOther.AddRange(lstOther);
            return(View(objOtherItem));
        }
コード例 #4
0
        public ActionResult Edit(EmpOtherItem model)
        {
            int Empid = Convert.ToInt32(Url.RequestContext.RouteData.Values["id"].ToString());

            model.EmpId       = Empid;
            model.UpdatedBy   = Convert.ToString(Empid);
            model.UpdatedDate = System.DateTime.Now;
            EmpOtherService objOther = new EmpOtherService();

            objOther.Update(model);
            ViewBag.Empid = Empid;
            return(RedirectToAction("Create", new { @id = Empid }));
        }
コード例 #5
0
        public ActionResult Create(EmpOtherItem model)
        {
            model.Status = "Active";
            int Empid = Convert.ToInt32(Url.RequestContext.RouteData.Values["id"].ToString());

            model.EmpId       = Empid;
            model.CreatedBy   = Convert.ToString(Empid);
            model.CreatedDate = System.DateTime.Now;
            EmpOtherService objEmpOther = new EmpOtherService();

            objEmpOther.Insert(model);
            return(RedirectToAction("Create"));
        }
コード例 #6
0
ファイル: EmpOtherService.cs プロジェクト: KuldipBhuva/TDMS
 public int Insert(EmpOtherItem model)
 {
     try
     {
         Mapper.CreateMap <EmpOtherItem, EmployeeOtherDetail>();
         EmployeeOtherDetail objEmpOther = Mapper.Map <EmployeeOtherDetail>(model);
         DbContext.EmployeeOtherDetails.Add(objEmpOther);
         return(DbContext.SaveChanges());
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
コード例 #7
0
        public ActionResult Create()
        {
            int Empid = Convert.ToInt32(Url.RequestContext.RouteData.Values["id"].ToString());

            EmpOtherService     objOther  = new EmpOtherService();
            List <EmpOtherItem> listOther = new List <EmpOtherItem>();

            listOther     = objOther.OtherListData(Empid);
            ViewBag.Empid = Empid;
            EmpOtherItem objDepitem = new EmpOtherItem();

            objDepitem.ListOther = new List <EmpOtherItem>();
            objDepitem.ListOther.AddRange(listOther);
            return(View(objDepitem));
        }