public HttpResponseMessage GetChildById([FromUri] int id, ChildAddRequest payload) { ChildService childSvc = new ChildService(); Child child = childSvc.GetChildById(id); return(Request.CreateResponse(HttpStatusCode.OK, child)); } //GetChildById
public Main(ChildService cServ, EventService eServ, Login l) { this.cService = cServ; this.eService = eServ; this.login = l; InitializeComponent(); }
private ChildService CreateChildService() { var userId = Guid.Parse(User.Identity.GetUserId()); var service = new ChildService(userId); return(service); }
public HttpResponseMessage GetChilds() { ChildService childSvc = new ChildService(); List <Child> childList = childSvc.GetChilds(); return(Request.CreateResponse(HttpStatusCode.OK, childList)); } //GetChilds
public Login(UserService uServ, ChildService cServ, EventService eServ) { this.uService = uServ; this.cService = cServ; this.eService = eServ; InitializeComponent(); }
public HttpResponseMessage DeleteChild([FromUri] int id) { ChildService childSvc = new ChildService(); childSvc.DeleteChild(id); return(Request.CreateResponse(HttpStatusCode.OK, id)); } //DeleteChild
public HttpResponseMessage CreateChild(ChildAddRequest payload) { ItemResponse <int> response = new ItemResponse <int>(); ChildService childSvc = new ChildService(); response.Item = childSvc.CreateChild(payload); return(Request.CreateResponse(response)); } //CreateChild
// GET: Child public ActionResult Index() { var userId = Guid.Parse(User.Identity.GetUserId()); var service = new ChildService(userId); var model = service.GetChildren(); return(View(model)); }
public HttpResponseMessage UploadImage([FromUri] int id) { string imageName = null; var httpRequest = HttpContext.Current.Request; //Upload Image var postedFile = httpRequest.Files["Image"]; //Create custom filename imageName = new String(Path.GetFileNameWithoutExtension(postedFile.FileName).Take(10).ToArray()).Replace(" ", "-"); imageName = imageName + DateTime.Now.ToString("yymmssfff") + Path.GetExtension(postedFile.FileName); var filePath = HttpContext.Current.Server.MapPath("~/Images/" + imageName); postedFile.SaveAs(filePath); ChildService.UpdateImageChild(id, filePath); return(Request.CreateResponse(HttpStatusCode.Created)); }
static void Main() { log4net.Config.XmlConfigurator.Configure(); logger.Info("Program Started"); UserDbRepo urepo = new UserDbRepo(); ChildDbRepo crepo = new ChildDbRepo(); EventDbRepository erepo = new EventDbRepository(); ChildValidator cvalidator = new ChildValidator(); EventValidator evalidator = new EventValidator(); UserService userv = new UserService(urepo); ChildService cserv = new ChildService(crepo, cvalidator); EventService eserv = new EventService(erepo, evalidator); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new Login(userv, cserv, eserv)); //ChildDbRepo repo = new ChildDbRepo(); //Child c = repo.save(new Child("Adrian", "Ionel", 9)); logger.Info("Program ended."); }
public SomeService(ChildService childService) { ChildService = childService; }
public HomeController(ChildService childService) { _childService = childService; }
public HttpResponseMessage AddChild([FromBody] Child child) { int id = ChildService.AddChild(child); return(Request.CreateResponse(HttpStatusCode.Created, id)); }
public ChildController() { igroup36_prodEntities db = new igroup36_prodEntities(); new_Child = new ChildService(db); }