public async Task <ChangedPlanedInspectionRoute> Update(ChangedPlanedInspectionRoute input) { using (var conn = new SqlConnection(AppSettings.ConnectionString)) { await conn.ExecuteAsync(_sql.Update(input)); return(await ById(input.Id)); } }
public async Task <ChangedPlanedInspectionRoute> Add(ChangedPlanedInspectionRoute input) { using (var conn = new SqlConnection(AppSettings.ConnectionString)) { var id = await conn.QueryFirstOrDefaultAsync <int>(_sql.Add(input)); return(await ById(id)); } }
public async Task <JsonResult> AddOrUpdate([FromBody] ChangedPlanedInspectionRoute input) { await CheckPermission(); var sqlR = new ChangedPlanedInspectionRoutesRepository(_logger); if (input.Id == 0) { return(Json(await sqlR.Add(input))); } return(Json(await sqlR.Update(input))); }
public string Add(ChangedPlanedInspectionRoute input) { return($@" insert into {Table} (ChangeDate, ChangeUserId, CheckListType, Droped, [End], PlanedInspectionRouteId, Start) values ('{input.ChangeDate}', '{input.ChangeUserId}', '{(int)input.CheckListType}' , '{input.Droped}', '{ input.End }', '{input.PlanedInspectionRouteId}', '{input.Start}') SELECT SCOPE_IDENTITY() "); }
public async Task <JsonResult> ChangeInspection([FromBody] ChangedPlanedInspectionRoute request) { if (request == null) { throw new ValidationException("Не распарсилось или пристали null"); } var user = await CheckPermission(); var service = new ScheduleChangedService(_logger, _mapper, user.Id); var result = await service.AddOrUpdateChangeInspection(request); return(Json(result)); }
public string Update(ChangedPlanedInspectionRoute input) { if (input.CheckListType == null) { return($@" update {Table} set ChangeDate = '{input.ChangeDate}', ChangeUserId = '{input.ChangeUserId}', Droped = {input.Droped} , End = {input.End} , PlanedInspectionRouteId = {input.PlanedInspectionRouteId}, Start = {input.Start}, UpdateDate = CURRENT_TIMESTAMP where id = {input.Id} "); } return($@" update {Table} set ChangeDate = '{input.ChangeDate}', ChangeUserId = '{input.ChangeUserId}', CheckListType = {(int)input.CheckListType}, Droped = '{input.Droped}' , [End] = '{input.End}' , PlanedInspectionRouteId = {input.PlanedInspectionRouteId}, Start = '{input.Start}' where id = {input.Id} "); }