public void CreateNewApp(AppDto appDto) { ValidateParameter.Validate(appDto); var app = appDto.ConvertToModel<AppDto, App>(); var internalApp = new App(app.Name, app.IconUrl, app.AppUrl, app.Width, app.Height, app.AppTypeId, app.AppAuditState, app.AppStyle, app.AccountId, app.Remark, app.IsMax, app.IsFull, app.IsSetbar, app.IsOpenMax, app.IsFlash, app.IsDraw, app.IsResize); Repository.Create<App>().Add(internalApp); UnitOfWork.Commit(); }
/// <summary> /// 封装从页面传入的forms表单到AppDto类型 /// </summary> /// <param name="forms"></param> /// <returns></returns> private static AppDto WrapperAppDto(FormCollection forms) { var appDto = new AppDto { IconUrl = forms["val_icon"], Name = forms["val_name"], AppTypeId = Int32.Parse(forms["val_app_category_id"]), AppUrl = forms["val_url"], Width = Int32.Parse(forms["val_width"]), Height = Int32.Parse(forms["val_height"]), AppStyle = Int32.Parse(forms["val_type"]), IsResize = Int32.Parse(forms["val_isresize"]) == 1, IsOpenMax = Int32.Parse(forms["val_isopenmax"]) == 1, IsFlash = Int32.Parse(forms["val_isflash"]) == 1, Remark = forms["val_remark"], AppAuditState = Int32.Parse(forms["val_verifytype"]), AppReleaseState = 2 //未发布 }; if ((forms["val_Id"] + "").Length > 0) { appDto.Id = Int32.Parse(forms["val_Id"]); } return appDto; }
public void ModifyAccountAppInfo(Int32 accountId, AppDto appDto) { ValidateParameter.Validate(accountId).Validate(appDto); AppContext.ModifyAppInfoServices.ModifyAccountAppInfo(accountId, appDto.ConvertToModel<AppDto, App>()); UnitOfWork.Commit(); }