//create an intervention public void CreateIntervention(int interventionTypeId, int clientId, string interventionHour, string interventionCost) { var repos = new InterventionsRepository(context); Interventions intervention = new Interventions(); intervention.UserId = HttpContext.Current.User.Identity.GetUserId(); intervention.InterventionTypeId = interventionTypeId; intervention.ClientId = clientId; intervention.CreateDate = DateTime.Now; intervention.InterventionHours = Convert.ToDecimal(interventionHour); intervention.InterventionCost = Convert.ToDecimal(interventionCost); intervention.Status = (validateUserForStatus(intervention.InterventionHours, intervention.InterventionCost)) ? (int)Status.Approved : (int)Status.Proposed; intervention.Operator = ""; try { repos.Insert(intervention); } catch (Exception) { throw new FailedToCreateRecordException(); } }