Example #1
0
        public int Update(ChallanModel model)
        {
            Mapper.CreateMap <ChallanModel, ChallanMaster>();
            ChallanMaster objComp = Dbcontext.ChallanMasters.SingleOrDefault(m => m.CID == model.CID);

            objComp = Mapper.Map(model, objComp);
            return(Dbcontext.SaveChanges());
        }
Example #2
0
        public int Insert(ChallanModel model)
        {
            Mapper.CreateMap <ChallanModel, ChallanMaster>();
            ChallanMaster objCompany = Mapper.Map <ChallanMaster>(model);

            Dbcontext.ChallanMasters.Add(objCompany);
            //Dbcontext.SaveChanges();

            //int id = Dbcontext.ChallanMasters.Max(m => m.CID);
            //if (id != null && id != 0)
            //{
            //    model.CID = id;
            //    Mapper.CreateMap<ChallanModel, ChallanTran>();
            //    ChallanTran objTran = Mapper.Map<ChallanTran>(model);
            //    Dbcontext.ChallanTrans.Add(objTran);
            //}
            return(Dbcontext.SaveChanges());
        }