예제 #1
0
        public MakeResult Create(MakeParam param)
        {
            Data.Entity.Make entity = MakeParamConverter.Convert(param, null);
            MakeDao.Save(entity);

            return(MakeResultConverter.Convert(entity));
        }
예제 #2
0
        public ApiResponse Create(MakeParam param)
        {
            MakeProcessor = new MakeProcessor();
            Response      = new ApiResponse();

            try
            {
                Response.text   = JsonConverter.JsonConverter.ObjToJson(MakeProcessor.Create(param));
                Response.result = true;

                return(Response);
            }

            catch
            {
                Response.text   = "Something went wrong :(";
                Response.result = false;

                return(Response);
            }
        }
예제 #3
0
        public ApiResponse Update(long id, MakeParam param)
        {
            MakeProcessor = new MakeProcessor();
            Response      = new ApiResponse();

            try
            {
                MakeProcessor.Update(id, param);
                Response.text   = "Entity was successfully updated";
                Response.result = true;

                return(Response);
            }
            catch
            {
                Response.text   = "Unfortunately something went wrong :(";
                Response.result = false;

                return(Response);
            }
        }
예제 #4
0
        public Data.Entity.Make Convert(MakeParam param, Data.Entity.Make oldentity)
        {
            Data.Entity.Make entity = null;

            if (oldentity != null)
            {
                entity = oldentity;
            }
            else
            {
                entity = new Data.Entity.Make
                {
                    Code        = param.Code,
                    Id          = param.Id,
                    Description = param.Description,
                    Name        = param.Name
                };
            }

            return(entity);
        }
예제 #5
0
 public void ValidateParameters(MakeParam param)
 {
     throw new NotImplementedException();
 }
예제 #6
0
 public void Update(long id, MakeParam param)
 {
     Data.Entity.Make oldEntity = MakeDao.Find(id);
     Data.Entity.Make newEntity = MakeParamConverter.Convert(param, null);
     MakeDao.Update(newEntity);
 }