public void UpdateHourRate(CreateHourRateDto hourRate) { var existingRate = _context.HourRate .Where(hr => hr.FromDate == hourRate.FromDate && hr.TaskId == hourRate.TaskId) .FirstOrDefault(); existingRate.Rate = hourRate.Rate; _context.SaveChanges(); }
public void CreateHourRate(CreateHourRateDto hourRate) { var newRate = new HourRate { FromDate = hourRate.FromDate, Rate = hourRate.Rate, TaskId = hourRate.TaskId }; _context.HourRate.Add(newRate); _context.SaveChanges(); }