Example #1
0
        public HttpResponseMessage GetChildById([FromUri] int id, ChildAddRequest payload)
        {
            ChildService childSvc = new ChildService();
            Child        child    = childSvc.GetChildById(id);

            return(Request.CreateResponse(HttpStatusCode.OK, child));
        } //GetChildById
Example #2
0
 public Main(ChildService cServ, EventService eServ, Login l)
 {
     this.cService = cServ;
     this.eService = eServ;
     this.login    = l;
     InitializeComponent();
 }
Example #3
0
        private ChildService CreateChildService()
        {
            var userId  = Guid.Parse(User.Identity.GetUserId());
            var service = new ChildService(userId);

            return(service);
        }
Example #4
0
        public HttpResponseMessage GetChilds()
        {
            ChildService childSvc  = new ChildService();
            List <Child> childList = childSvc.GetChilds();

            return(Request.CreateResponse(HttpStatusCode.OK, childList));
        } //GetChilds
Example #5
0
 public Login(UserService uServ, ChildService cServ, EventService eServ)
 {
     this.uService = uServ;
     this.cService = cServ;
     this.eService = eServ;
     InitializeComponent();
 }
Example #6
0
        public HttpResponseMessage DeleteChild([FromUri] int id)
        {
            ChildService childSvc = new ChildService();

            childSvc.DeleteChild(id);

            return(Request.CreateResponse(HttpStatusCode.OK, id));
        } //DeleteChild
Example #7
0
        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
Example #8
0
        // GET: Child
        public ActionResult Index()
        {
            var userId  = Guid.Parse(User.Identity.GetUserId());
            var service = new ChildService(userId);
            var model   = service.GetChildren();

            return(View(model));
        }
Example #9
0
        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));
        }
Example #10
0
        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.");
        }
Example #11
0
 public SomeService(ChildService childService)
 {
     ChildService = childService;
 }
 public HomeController(ChildService childService)
 {
     _childService = childService;
 }
Example #13
0
        public HttpResponseMessage AddChild([FromBody] Child child)
        {
            int id = ChildService.AddChild(child);

            return(Request.CreateResponse(HttpStatusCode.Created, id));
        }
Example #14
0
        public ChildController()
        {
            igroup36_prodEntities db = new igroup36_prodEntities();

            new_Child = new ChildService(db);
        }