Base solution for your next web application
Ends in:
01 DAYS
01 HRS
01 MIN
01 SEC

Activities of "shaileshbc"

Answer

Dear hikalkan, Thank you for quick response. i will check and in case of any issue, will get back to you.

The code is from domain service, hence used actual entity rather than dto.

regards Shailesh

thanks for your tip, i will work on it. regards Shailesh

Answer
public async Task UpdateAsync(Guard guard)
        {
            //Guard updateGuard = Guard.Create
            //(guard.SiteId,guard.GuardNo,guard.GuardName,guard.CardNo,guard.IsActive,guard.Id);
            //Guard _guard = await GetGuardUsingGuardNoAsync(updateGuard.GuardNo);
            //if (_guard != null && _guard.Id != updateGuard.Id)
            //    throw new UserFriendlyException("Guard No. already Exists!");
            //_guard = await GetGuardUsingCardNoAsync(guard.CardNo);
            //if (_guard != null && _guard.Id != guard.Id)
            //    throw new UserFriendlyException("Card No. already Exists!");
            await _guardRepository.UpdateAsync(guard);
        }

if i uncomment the code and run it, then while saving entity i get : System.InvalidOperationException: Attaching an entity of type 'GTMS.Domain.Guard' failed because another entity of the same type already has the same primary key value.

here primary key is ID and it is autonumber.

Commented Code checks for duplication of field value. with above coding, software can update the entity, but when uncommented, it gives above error. regards Shailesh

Is it possible to have different Menus for Different User Roles? i.e. based on User Role, Menus will be hidden/visible. regards Shailesh

Question

i am using EventCloud application ( latest downloaded from github) and added one or more entity. Based on event entity, i have created CRUD for my entities and they gets updated when their is no validation on entity, but fails if any validation is done on entity in Core project. Validation - checking whether one of the field is not getting duplicated before updating. It tries to add entity rather than updating entity. so how to solve, this issue.

Showing 1 to 5 of 5 entries