public HttpResponseMessage UpdateChild(DTO.dtoChild child) { try { BLL.Children.UpdateChild(child); return Request.CreateResponse(HttpStatusCode.OK, true); } catch (Exception ex) { return Request.CreateErrorResponse(HttpStatusCode.NotFound, ex.Message); } }
public static Child castToDal(dtoChild objToCast) { using (TimeTableDevEntities db = new TimeTableDevEntities()) { return(new Child() { IdentityNum = objToCast.IdentityNum, FamilyId = objToCast.FamilyId, FirstName = objToCast.FirstName, Kind = objToCast.Kind, BirthDate = objToCast.BirthDate, PlaceInFamily = objToCast.PlaceInFamily, SchoolId = objToCast.SchoolId, Grade = objToCast.Grade, JoiningDate = objToCast.JoiningDate, }); } }
public static List <dtoChild> castToDto(List <Child> children) { List <dtoChild> newChildren = new List <dtoChild>(); for (var item = 0; item < children.Count; item++) { dtoChild newChild = new dtoChild() { IdentityNum = children[item].IdentityNum, FamilyId = children[item].FamilyId, FirstName = children[item].FirstName, Kind = children[item].Kind, BirthDate = children[item].BirthDate, PlaceInFamily = children[item].PlaceInFamily, SchoolId = children[item].SchoolId, Grade = children[item].Grade, JoiningDate = children[item].JoiningDate, }; newChildren.Add(newChild); } return(newChildren); }