Example #1
0
        public static IHttpContext registrationEdit(IHttpContext context, string regId)
        {
            try
            {
                if (!context.token().hasPermission("registrations.write"))
                {
                    context.Response.StatusCode = HttpStatusCode.NotFound;
                    context.Response.SendResponse("");
                    return(context);
                }

                var      valBuilder = new ValidationBuilder();
                string[] valArray   =
                {
                    "name=Id,isRequired=,isNumeric=",
                    "name=Time,isRequired=,isDateTime=",
                    "name=UserId,isRequired=",
                    "name=DepartmentId,isRequired=",
                    "name=StatusId,isRequired="
                };
                var collection = valBuilder.build(valArray);

                var reg = BaseController.getUserInput <Registrations>(context, collection);

                Registrations.edit(reg, uint.Parse(regId));

                var data = Parsers.parseURLEncoded(context.Request.Payload);
                context.Response.SendResponse("");
            }
            catch (Exception ex)
            {
                context.Response.StatusCode = HttpStatusCode.InternalServerError;
                context.Response.SendResponse(ex.Message);
            }
            return(context);
        }