public void Update(ProjectRateModel model)
        {
            var rate = this.Context.ProjectRates.FirstOrDefault(r => r.ProjectRateId == model.ProjectRateId);

            rate.ExternalRate = model.ExternalRate;
            this.Save();
        }
        public void Insert(ProjectRateModel model)
        {
            var rate = ProjectRateMapper.ToDBProjectRate(model);

            this.Context.ProjectRates.Add(rate);
            this.Save();
        }
예제 #3
0
 public static ProjectRates ToDBProjectRate(ProjectRateModel model)
 {
     return(new ProjectRates()
     {
         ProjectId = model.ProjectId,
         UserId = model.UserId,
         ExternalRate = model.ExternalRate
     });
 }
        public JsonResult SaveProjectUserRate(ProjectRateModel model)
        {
            if (model.UserId != 0 || model.ProjectId != 0)
            {
                var exist = this._projectRatesProvider.GetForUserAndProject(model.UserId, model.ProjectId);

                if (exist == null)
                {
                    this._projectRatesProvider.Insert(model);
                }
                else
                {
                    model.ProjectRateId = exist.ProjectRateId;
                    this._projectRatesProvider.Update(model);
                }

                return(Json(new { Saved = true }));
            }
            else
            {
                return(Json(new { Saved = false, ErrorMsg = "Select project and user." }));
            }
        }
예제 #5
0
 public void Update(ProjectRateModel model)
 {
     this._projectRateRepository.Update(model);
 }
예제 #6
0
 public void Insert(ProjectRateModel model)
 {
     this._projectRateRepository.Insert(model);
 }