public static void Update(EstimateBO estimateToUpdate)
        {
            EstimateDBEntities context = new EstimateDBEntities();
            GenericRepository <EstimateHeader> repo = new GenericRepository <EstimateHeader>(context);

            var config   = new MapperConfiguration(cfg => cfg.CreateMap <EstimateBO, EstimateHeader>());
            var mapper   = config.CreateMapper();
            var estimate = mapper.Map <EstimateHeader>(estimateToUpdate);

            //var estimate = new EstimateHeader
            //{
            //    AAC_PER = estimateToUpdate.AAC_PER,
            //    Agency = estimateToUpdate.Agency,
            //    BrandID = estimateToUpdate.BrandID,
            //    Campaign = estimateToUpdate.Campaign,
            //    ClientID = estimateToUpdate.ClientID,
            //    EST_Date = estimateToUpdate.EST_Date,
            //    EST_ID = estimateToUpdate.EST_ID,
            //    EST_NO = estimateToUpdate.EST_NO,
            //    Gross_Cost = estimateToUpdate.Gross_Cost,
            //    Net_Cost = estimateToUpdate.Net_Cost,
            //    PeriodFrom = estimateToUpdate.PeriodFrom,
            //    PeriodTo = estimateToUpdate.PeriodTo,
            //    PO_Date = estimateToUpdate.PO_Date,
            //    PO_NO = estimateToUpdate.PO_NO,
            //    SAC_PER = estimateToUpdate.SAC_PER,
            //    Status = estimateToUpdate.Status

            //};
            repo.Update(estimate);

            repo.Save();
        }
Beispiel #2
0
 public ActionResult SaveEstimate(EstimateBO estimateEntity)
 {
     if (estimateEntity.EST_ID != 0 && estimateEntity.EST_ID != null)
     {
         EstimateData.Update(estimateEntity);
         return(new HttpStatusCodeResult(201, "Update successful"));
     }
     else
     {
         EstimateData.Save(estimateEntity);
         return(new HttpStatusCodeResult(201, "Creation successful"));
     }
 }