public void ChangeOperation(SingleOperation operation, int userID)
 {
     var item = _context.RepositoryOperations.FirstOrDefault(x => x.ID == operation.Id && x.UserID == userID);
     if (item != null)
     {
         item.OperationName = operation.OperationName;
         item.OperationValue = operation.Value;
     }
     _context.SaveChanges();
 }
示例#2
0
 /// <summary>
 /// Add a rent operation to the day
 /// </summary>
 /// <param name="operation">Object <see cref="SingleOperation"/></param>
 public void AddRentOperation(SingleOperation operation)
 {
     RentDaysSingleOperations.Add(operation);
     _sumRent = RentDaysSingleOperations.Sum(x => x.Value);
 }
示例#3
0
 /// <summary>
 /// Add a span operation to the day
 /// </summary>
 /// <param name="operation">Object <see cref="SingleOperation"/></param>
 public void AddSpanOperation(SingleOperation operation)
 {
     operation.Id = operation.Id;
     SpanDaysSingleOperations.Add(operation);
     _sumSpan = SpanDaysSingleOperations.Sum(x => x.Value);
 }
示例#4
0
 /// <summary>
 /// Add a new operation
 /// </summary>
 /// <param name="year">Year of operation</param>
 /// <param name="month">Month op operation</param>
 /// <param name="day">Day of operation</param>
 /// <param name="operation">Object of class <see cref="SingleOperation"/>, that provides a description of the new operation</param>
 public void AddDaySpanOperation(int year, int month, int day, SingleOperation operation)
 {
     if(_years.SingleOrDefault(x=>x.Name == year) == null)
         _years.Add(new Year(year));
     _years.Single(x => x.Name == year).GetMonth(month).GetDay(day).AddSpanOperation(operation);
     if(!_autocompleteTags.Contains(operation.OperationName))
         _autocompleteTags.Add(operation.OperationName);
 }