public IActionResult UpdateInternship([FromBody] InternshipMainAttributesViewModel internshipView, int id) { try { var internship = InternshipMapper.ToActualInternshipObject(internshipView); _internshipService.UpdateInternship(internship, id); } catch (Exception e) { return(BadRequest(e.Message)); } return(Ok()); }
public static Internship ToActualInternshipObject(InternshipMainAttributesViewModel internshipView) { return(new Internship() { Description = internshipView.Description, Places = internshipView.Places, Topics = internshipView.Topics, Start = DateTime.Parse(internshipView.Start), End = DateTime.Parse(internshipView.End), Weeks = internshipView.Weeks, Name = internshipView.Name }); }