public void updateChildren(ChildDTO childDTO, List <ChallengeDTO> challenges) { UpdateDTO update = new UpdateDTO(childDTO, challenges); UserEventArgs userArgs = new UserEventArgs(UserEvent.NewChild, update); OnUserEvent(userArgs); }
public bool Update(UpdateDTO dTO, int id) { bool result = false; var TagList = new List <Tag>(); foreach (var item in dTO.Tags) { Tag tag = new Tag(); tag.NameTag = item.NameTag; TagList.Add(tag); } var ven = _repository.GetByIdVender(id); ven.VendorName = dTO.VendorName; ven.Title = dTO.Title; ven.PhoneNumber = dTO.PhoneNumber; ven.Address = dTO.Address; ven.Tag = TagList; var resultvendor = _repository.UpdateVendor(ven); if (resultvendor > 0) { result = true; } return(result); }
private void UpdateChallenges(UpdateDTO update) { List <ChallengeDTO> challenges = update.Challenges; //ChallengesDataGridView.Rows.Clear(); ChallengesDataGridView.DataSource = challenges; }
public bool StatusNext(UpdateDTO request, Guid userId) { var currentStatus = Get(request.Id).Status; if (currentStatus == TestStatus.Completed) { return(false); } var analysisTestEntity = new AnalysisTestEntity() //AutoMapper { Id = request.Id, TimeStamp = request.TimeStamp, Status = currentStatus + 1, DateModified = DateTime.UtcNow, ModifiedBy = userId, }; _context.AnalysisTests.Attach(analysisTestEntity); _context.Entry(analysisTestEntity).Property(x => x.Status).IsModified = true; _context.Entry(analysisTestEntity).Property(x => x.DateModified).IsModified = true; _context.Entry(analysisTestEntity).Property(x => x.ModifiedBy).IsModified = true; return(_context.SaveChanges() == 1); }
public async Task <IdentityResult> UpdateUser(UpdateDTO model, UserModel user) { user.FirstName = model.FirstName ?? user.FirstName; user.LastName = model.LastName ?? user.LastName; user.Photo = model.Photo ?? user.Photo; return(await _userManager.UpdateAsync(user)); }
private void updateTable(DataGridView gv, UpdateDTO upd) { foreach (DataGridViewRow row in gv.Rows) { if (((int)row.Cells[0].Value) == upd.Eid) { int old = (int)row.Cells[4].Value; row.Cells[4].Value = old - upd.NrLocuri; } } }
public void userUpdate(object sender, UserEventArgs e) { if (e.UserEvent == UserEvent.NewChild) { UpdateDTO update = (UpdateDTO)e.Data; ChildDTO child = update.Child; List <ChallengeDTO> challenges = update.Challenges; ChildrenDataGridView.BeginInvoke(new UpdateDelegate(this.UpdateChildren), new Object[] { update }); ChallengesDataGridView.BeginInvoke(new UpdateDelegate(this.UpdateChallenges), new Object[] { update }); } }
public override UpdateDTO <User> Insert(FilterDTO filters) { UpdateDTO <User> result = new UpdateDTO <User>(); string query = QueryInsertFields(filters); bool success = Database.ExecOverig(query); return(new UpdateDTO <User>() { Success = success, Obj = FromDataRow(Database.ExecSelect(selectQuery + " order by " + PrimaryKey + " desc").Rows[0]) }); }
public ActionResult <Result <bool> > GoToNextStatus([FromBody] UpdateDTO body) { var success = _synthesisRepo.StatusNext(body, UserId); if (success) { return(Result <bool> .Success(true)); } else { return(Result <bool> .Fail("Failed to save changes.")); } }
public IActionResult Update([FromRoute] int id, UpdateDTO dTO) { var result = _service.Update(dTO, id); if (result) { return(Ok()); } else { throw new Exception(); } }
private void UpdateChildren(UpdateDTO update) { ChildDTO child = update.Child; List <ChildDTO> children = new List <ChildDTO>(); foreach (DataGridViewRow row in ChildrenDataGridView.Rows) { children.Add((ChildDTO)row.DataBoundItem); } children.Add(child); //ChildrenDataGridView.Rows.Clear(); ChildrenDataGridView.DataSource = children; }
public IHttpActionResult UpdateQueryExecute(UpdateDTO model) { try { string TempTable = "User" + DateTime.Now.Millisecond.ToString(); ArrayList aa = new ArrayList(); string d = ""; string query = "select * into " + TempTable + " from " + model.TableName; //query+= "Update " + TempTable+" " + model.Query; // query += "update ##tempTable set productName='sumsung' where productId=1"; string connectionString = @"Data Source=MALIKKALEEM\SQLEXPRESS01;Initial Catalog=Ecomerce;Integrated Security=True;User ID=sa;Password=l23"; using (SqlConnection con = new SqlConnection(connectionString)) { con.Open(); using (SqlCommand cmd = new SqlCommand(query, con)) { int c = cmd.ExecuteNonQuery(); } //update query string q = "Update " + TempTable + " " + model.Query; using (SqlCommand cmd = new SqlCommand(q, con)) { int c = cmd.ExecuteNonQuery(); } q = "select * from " + TempTable; using (SqlCommand cmd = new SqlCommand(q, con)) { SqlDataAdapter da = new SqlDataAdapter(cmd); DataTable dt = new DataTable(); da.Fill(dt); int a = dt.Rows.Count; var r = dt.Rows[0].Table; aa.Add(r); } string drop = "drop table " + TempTable; using (SqlCommand cmd = new SqlCommand(drop, con)) { cmd.ExecuteNonQuery(); } } return(Ok(aa)); }catch (Exception ex) { return(BadRequest(ex.ToString())); } }
public override UpdateDTO <User> Update(FilterDTO filters) { UpdateDTO <User> result = new UpdateDTO <User>(); string pKeyValue = filters.Fields.Where(f => f.Key.ToLower() == PrimaryKey.ToLower()).FirstOrDefault().Value; string where = " where " + PrimaryKey + " = '" + pKeyValue + "'"; string query = "update " + Table + QueryFields(filters) + where; bool success = Database.ExecOverig(query); return(new UpdateDTO <User>() { Success = success, Obj = FromDataRow(Database.ExecSelect(selectQuery + where).Rows[0]) }); }
public bool UpdateUserCode(int userId, string code) { var data = new FilterDTO { Fields = new List<KeyValuePair<string, string>>() { new KeyValuePair<string, string>("id", userId.ToString()), new KeyValuePair<string, string>("code", code.ToString()) } }; UpdateDTO<User> result = client.Send<UpdateDTO<User>>(data, HttpRequestType.POST, "user/update"); if (result != null) { return result.Success; } return false; }
public async Task <int> Update(UpdateDTO dTO, int id) { var TagList = new List <Tag>(); foreach (var item in dTO.Tags) { Tag tag = new Tag(); tag.NameTag = item.NameTag; TagList.Add(tag); } var ven = _repository.GetByIdVender(id); ven.VendorName = dTO.VendorName; ven.Title = dTO.Title; ven.PhoneNumber = dTO.PhoneNumber; ven.Address = dTO.Address; ven.Tag = TagList; return(await _repository.UpdateVendor(ven)); }
public IActionResult Update(int id, [FromBody] UpdateDTO nuevoDTO) { var usuario = _mapper.Map <User>(nuevoDTO); //Seteo el id al DTO usuario.Id = id; //Control: username unico if (_context.Users.Any(x => x.Username == nuevoDTO.Username && x.Id != usuario.Id)) { return(BadRequest(new { message = "El usermane especificado ya no se encuentra disponible" })); } //Control: email unico if (_context.Users.Any(x => x.Email == nuevoDTO.Email && x.Id != usuario.Id)) { return(BadRequest(new { message = "El email especificado ya se encuentra registrado" })); } _userService.Update(usuario, nuevoDTO.Password); return(Ok()); }
public async Task <IActionResult> UpdateUser([FromBody] UpdateDTO model) { if (ModelState.IsValid) { var userCheck = await _userManager.GetUserAsync(User); var user = await _user.UpdateUser(model, userCheck); if (user == null) { return(NotFound()); } if (user.Succeeded) { return(Ok("Updated Successfully")); } else { return(BadRequest(user.Errors)); } } return(BadRequest("Invalid Details")); }
public IActionResult UpdateThemesFromEdit([FromBody] UpdateDTO updateDTO) { return(Ok(LessonPlanRepo.UpdateThemesFromEdit(updateDTO))); }
public async Task <IActionResult> Update([FromRoute] int id, UpdateDTO dTO) { return(Ok(await _service.Update(dTO, id))); }
public IActionResult UpdateLocations([FromBody] UpdateDTO updateDTO) { return(Ok(LessonPlanRepo.UpdateLocation(updateDTO))); }
public IActionResult UpdateName([FromBody] UpdateDTO updateDTO) { return(Ok(LessonPlanRepo.UpdateLessonName(updateDTO))); }